<%@ page language="java" contentType="text/html; charset=utf-8"%>
<html>
<head>
<%@ include file="/extjs/include/all.jsp"%>
<title>日志管理</title>
</head>
<body>
<div id="loggers" style="width:100%"></div>
</body>
</html>
<script>
Ext.onReady(function(){

  	var loggerStore = new Ext.data.JsonStore({
		url: '${pageContext.request.contextPath}/edu.ccut.saturn.manager.logger.impl::/loggerModule/ExtAction/QueryLoggers.action',
		root: 'loggers',
		fields: [
			{name:'key'},
			{name:'level'}
		]
	});   
	loggerStore.load();
	
	var resultWidth = Ext.get("loggers").getWidth();
	var cm = new Ext.grid.ColumnModel([ 
	    new Ext.grid.RowNumberer(), 
        {header:'日志名称',dataIndex:'key',width:resultWidth*0.33,sortable:true}, 
        {header:'日志级别',dataIndex:'level',width:resultWidth*0.33,sortable:true}, 
        {header:'操作',dataIndex:'',width:resultWidth*0.30,sortable:true,renderer:function(value, p, record){
        	return String.format("<a href=\"${pageContext.request.contextPath}/edu.ccut.saturn.manager.logger.impl/loggerModule/ExtPage/loggerEdit.jsp?key={0}&level={1}\">修改</a>", 
	        		record.data.key,record.data.level
        	);
        }}
    ]); 
    cm.defaultSortable = true; 
       
	var grid = new Ext.grid.GridPanel({ 
	    el:'loggers', 
	    title:'日志管理', 
	    height:600, 
	    stripeRows: true,
	    collapsible:true,
	    bodyStyle:'width:100%',
	    trackMouseOver:false, 
	    loadMask: {msg:'正在加载数据，请稍侯……'}, 
	    store:loggerStore, 
	    cm: cm
	}); 
    grid.render(); 	
});
</script>